import Article from '@/views/Manage/Article/ArticleIndex.vue'
import Layout from '@/views/Manage/Layout/LayoutIndex.vue'
import LoginIndex from '@/views/Manage/Login/LoginIndex.vue'
import Category from '@/views/Manage/Category/CategoryIndex.vue'
import Tag from '@/views/Manage/Tag/TagIndex.vue'
import About from '@/views/Manage/About/AboutIndex.vue'
import User from '@/views/Manage/Users/UserIndex.vue'
import UserInfo from '@/views/Manage/Users/UserInfo.vue'
import Main from '@/views/Front/BlogePage.vue'
import Error from '@/views/Error.vue'
import ArticleView from '@/views/Front/ArticleView.vue'
import GalleryView from '@/views/Front/GalleryView.vue'
import MediaIndex from '@/views/Manage/Media/MediaIndex.vue'
import { createRouter, createWebHistory } from 'vue-router'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    // 前台
    {
      path: '/main',
      component: Main,
      children: [
        {
          path: '/articleView/:id?',
          component: ArticleView,
          meta: { title: "文章" },
        },
        {
          path: '/GalleryView',
          component: GalleryView,
          meta: { title: "图库" },
        },
        {
          path: '/ToolsView',
          component: About,
          meta: { title: "工具" },
        }
      ]
    },
    // 后台
    { path: '/login', component: LoginIndex },
    {
      path: '/',
      component: Layout,
      meta: { title: "首页" },
      children: [
        {
          path: '',
          component: About,
          meta: { title: "其他" },
        },
        {
          path: '/article',
          component: Article,
          meta: { title: "文章管理" },
        },
        {
          path: '/category',
          component: Category,
          meta: { title: "分类管理" },
        },
        {
          path: '/tag',
          component: Tag,
          meta: { title: "标签管理" },
        },
        {
          path: '/media',
          component: MediaIndex,
          meta: { title: "图片管理" },
        },
        {
          path: '/users',
          component: User,
          meta: { title: "用户相关" },
        },
        {
          path: '/userInfo',
          component: UserInfo,
          meta: { title: "用户信息" },
        },
      ]
    },

    {
      path: '/:xxx(.*)*',
      name: 'Error',
      component: Error
    },

  ]
})

export default router
